﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using University.Workshop.Business;

namespace University.Workshop.WinApp
{
    public partial class LoginUser : Form
    {
        public LoginUser()
        {
            InitializeComponent();
        }

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void buttonAccept_Click(object sender, EventArgs e)
        {
            string[] isValidUser = UserManager.LogOnUser(textBoxUserName.Text, textBoxPassword.Text);
            if (isValidUser!=null)
            {
                Main.userMenu = isValidUser;
                this.Close();
            }
            else
            {
                MessageBox.Show("Your login attempt was not successful. Please try again.");
            }
        }
    }
}
